package com.weilizhang.work1.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class RequestLogAspect {

    @Around("execution(* com.weilizhang.work1.contorl.StudentsContorl.*(..))")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        long startTime = System.currentTimeMillis();

        Object result = joinPoint.proceed(); // 执行方法

        long duration = System.currentTimeMillis() - startTime;
        System.out.println(joinPoint.getSignature() + " 耗时：" + duration + "ms");

        return result;
    }
}
